package cool.taomu.box.kademlia.test;

public class BEncodeUtils {
	/**
	 * 辅助方法：将字节数组转换为十六进制字符串表示
	 */
	public static String bytesToHex(byte[] bytes) {
		StringBuilder hexString = new StringBuilder();
		for (byte b : bytes) {
			String hex = Integer.toHexString(0xFF & b);
			if (hex.length() == 1) {
				hexString.append('0');
			}
			hexString.append(hex);
		}
		return hexString.toString();
	}
}
